import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;

public class StudentLoader {
	
	public static ArrayList<Student> load(String filename) {
		
	    // Declare list, an ArrayList to store Student objects
		


	    Scanner scanner = null;
		
            // The try block will catch errors when parsing file
	    try {
		scanner = new Scanner(new File(filename));
	 	scanner.useDelimiter("[,\\n]"); // For CSV

                // Build the list of students by repeatedly calling
                // method scanStudent until null is returned.






	    } catch (FileNotFoundException e) {
		    System.out.println("File not found!");
	    } catch (Exception e) {
		    System.out.println("An error occurred while reading the file: " + e.getMessage());
	    } finally {
		    if (scanner != null) {
		        scanner.close();
		    }
	     }

	     return list;
	}
	
	// method scanStudent:
}
